/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedbean.CI.Profile;

import entity.Employee;
import javax.faces.event.ActionEvent;
import java.io.IOException;
import java.io.Serializable;
import javax.ejb.EJB;
import javax.el.ELContext;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import managedbean.Controller;
import session.stateless.EmployeeBeanLocal;

/**
 *
 * @author Vincent
 */
@ManagedBean(name="viewProfileManagerBean")
@ViewScoped
public class ViewProfileManagerBean implements Serializable{
    @EJB 
    private EmployeeBeanLocal employeeBeanLocal; 
    /** Creates a new instance of PositionDataTableBean */
    
    private Employee employee;
    
    public ViewProfileManagerBean() {
    }

    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }
    
    public void initView(PhaseEvent event){
        ELContext elContext = FacesContext.getCurrentInstance().getELContext();
        Controller controller = (Controller) FacesContext.getCurrentInstance().getApplication().getELResolver().getValue(elContext, null, "controller");
        this.employee = controller.getEmployee();
    }
    
    public void editProfile(ActionEvent event) throws IOException
    {
        FacesContext.getCurrentInstance().getExternalContext().redirect("editProfile.xhtml"); 
    }
}
